/**
 * This class provides the keywords list based on the query string inputted by the user.
 * More analysis work could be added in the class if possible.  
 */
package qy.course.cse494.ir;

import java.util.Collection;
import java.util.Vector;

import qy.course.cse494.util.UtilCenter;

/**
 * @author qyan
 *
 */
public class DocumentQuery
{
	Vector<String> _keywords_vt = new Vector<String>();
	
	/**
	 * Default constructor
	 * @param query_str
	 */
	public DocumentQuery(final String query_str)
	{
		parse(query_str);
	}
	
	/**
	 * Analyze the inputting string, and get the containing keywords.
	 */
	protected void parse(final String query_str)
	{
		_keywords_vt = UtilCenter.ParseMultiInput(query_str, "\\w+");
	}
	
	
	public int get_number_of_keywords()
	{
		return _keywords_vt.size();
	}
	
	
	public String get_keyword(int i)
	{
		if(i >= _keywords_vt.size())
		{
			System.err.println("The keyword " + i + " doesn't exist!");
		}
		return _keywords_vt.elementAt(i);
	}
	
	
	public Collection<String> get_keyword_list()
	{
		return _keywords_vt;
	}
	
}
